<?php

namespace Database\Seeders;

use App\Enum\Common\Sort;
use App\Enum\Models\System\Config\Type;
use App\Models\System\Config;
use Illuminate\Database\Seeder;

class ConfigSeeder extends Seeder
{
    public static $data = [
        [
            'title' => '网站标题',
            'tip' => '网页的title',
            'name' => 'basic_title',
            'value' => '音创',
            'group' => 'basic',
            'type' => Type::Input,
            'rules' => 'required',
            'remark' => '公共接口返回,打开时设置title',
            'sort' => Sort::Important,
            'is_public' => 1,
        ],
        [
            'title' => '网站ico',
            'tip' => '网页的ico',
            'name' => 'basic_ico',
            'value' => '/favicon.ico',
            'group' => 'basic',
            'type' => Type::Upload,
            'is_public' => 1,
            'prop' => [
                // 查看前端上传组件
                // 上传类型 image单图 images多图 file单文件 files多文件
                'type' => 'image',
                // 是否显示选择
                'show_select' => 1,
                // 允许上传的类型
                'accept' => '.ico',
            ],
            'rules' => 'required',
            'remark' => '网页的ico',
            'sort' => Sort::Important,
        ],
        [
            'title' => '备案号',
            'tip' => '网站的备案号',
            'name' => 'basic_record',
            'value' => '备案号-9',
            'group' => 'basic',
            'type' => Type::Input,
            'rules' => 'required',
            'remark' => '',
            'sort' => Sort::Important,
            'is_public' => 1,
        ],
        [
            'title' => '登录验证码',
            'tip' => '关闭登录将不在验证验证码',
            'name' => 'auth_login_captcha',
            'value' => true,
            'group' => 'auth',
            'type' => Type::Switch,
            'rules' => '',
            'remark' => '',
            'sort' => Sort::Important,
            'is_public' => 1,
        ],
        [
            'title' => 'CDN',
            'tip' => '不填入默认使用本地资源,请确认好cdn回源设置正确',
            'name' => 'basic_cdn',
            'value' => '',
            'group' => 'basic',
            'type' => Type::Input,
            'rules' => '',
            'remark' => '',
            'sort' => Sort::Important,
            'is_public' => 1,
        ],
    ];

    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        foreach (self::$data as $item) {
            Config::create($item);
        }
    }
}
